<?php  
echo "Student list:<br>"; 
include('Student.php'); 
$students = array(); 

// 添加第一个学生信息
$first = new Student("Doe", "John"); 
$first->add_email('home', 'john@doe.com'); 
$first->add_email('work', 'jdoe@mcdonalds.com'); 
$first->add_grade(65); 
$first->add_grade(75); 
$first->add_grade(55); 
$students['j123'] = $first; 

// 添加第二个学生信息
$second = new Student("Einstein", "Albert"); 
$second->add_email('home', 'albert@braniacs.com'); 
$second->add_email('work1', 'a_einstein@bcit.ca'); 
$second->add_email('work2', 'albert@physics.mit.edu'); 
$second->add_grade(95); 
$second->add_grade(80); 
$second->add_grade(50); 
$students['a456'] = $second; 

// 添加第三个学生信息
$third = new Student("SiTian_Huang", "Albert"); 
$third->add_email('home', 'albert@braniacs.com'); 
$third->add_email('work1', 'a_einstein@dgpt.com'); 
$third->add_email('work2', 'albert@physics.mit.edu'); 
$third->add_grade(95); 
$third->add_grade(80); 
$third->add_grade(50);
$students['s789'] = $third; // 为第三个学生分配唯一键名

// 按数组键名（key）对学生数组进行升序排序
ksort($students); 

// 遍历输出学生信息
foreach ($students as $student) {
    // 由于使用了<br>，这里将换行符替换为HTML换行标签以正常显示
    echo nl2br($student->toString());
}